首页
标题：[!--pagetitle--]_<?=$public_r[sitename]?>
关键字：[!--pagekey--]
描述：[!--pagedes--]

https://www.cnnc280.cn/e/extend/DoTimeRepage/index.php     //定时刷新首页和栏目

$sql2 = "select * from {$dbtbpre}ecms_zb   where  to_days('" . $curdate . "')=to_days(livetime) and unix_timestamp(livetime)+9600>= " . time() . "  and  liansai in('世界杯','德甲','法甲','意甲','西甲','英超','欧冠','欧国联','中超')  order by unix_timestamp(livetime)   limit 30";
else
$sql2 = "select * from {$dbtbpre}ecms_zb   where  to_days('" . $curdate . "')=to_days(livetime)  and liansai in('世界杯','德甲','法甲','意甲','西甲','英超','欧冠','欧国联','中超') order by unix_timestamp(livetime)  limit 30";
$key_sql = $empire->query($sql2);
if(empty($empire->fetch($key_sql))){
    if ($m<1){
        $sql2 = "select * from {$dbtbpre}ecms_zb   where   to_days('" . $curdate . "')=to_days(livetime) and unix_timestamp(livetime)+9600>= " . time() . "   order by unix_timestamp(livetime)   limit 30";
    }else{
        $sql2 = "select * from {$dbtbpre}ecms_zb   where  to_days('" . $curdate . "')=to_days(livetime)   order by unix_timestamp(livetime)  limit 30";
    }
    $key_sql = $empire->query($sql2);
}

$cr=$empire->fetch1("select * from muban_la_enewsclass where
classid='".$GLOBALS[navclassid]."' limit 1");

<?=$cr['bname']?>
$cr=$empire->fetch1("select bname from muban_la_enewsclass where 
classid='".$GLOBALS[navclassid]."' limit 1");
echo $cr['bname'];
?>

$GLOBALS[navclassid]

############### 列表页获取数据############
$lsp=RepPostVar($_GET[lspy]);
$lsp=str_replace('/','',$lsp);
[e:loop={"zb",30,18,0,"lspy='".$lsp."' and unix_timestamp(livetime)+9600>= " . time() . "",'unix_timestamp(livetime) ASC'}]

if($r[title]==""){
$returl=$_SERVER['HTTP_REFERER'];
printerror2('暂无该赛事',$returl);
}

lspy= '" . $lsp. "'
############### 列表页获取数据############

############### 直播时间############
$new_time = date('Y年m月d日');
$tomorrow = date('Y年m月d日', strtotime('+1 day'));
$chineseWeekdays = ['日', '一', '二', '三', '四', '五', '六'];
$new_w = date('w');
$tomorrow_w = date('w',strtotime($tomorrow));

$tomorrow_w = date('w', strtotime("+1 day"));

$new_times = $new_time.' 星期'.$chineseWeekdays[$new_w];
$tomorrow_times = $tomorrow.' 星期'.$chineseWeekdays[$tomorrow_w];


$n_s_time = date('Y-m-d 00:00:00');
$n_e_time = date('Y-m-d 23:59:59');

$t_s_time = date('Y-m-d 00:00:00', strtotime('+1 day'));
$t_e_time = date('Y-m-d 23:59:59', strtotime('+1 day'));
$class_id = '11,12,13,14,15,16,17,18,19,20';

$twoHoursAgo = strtotime('-2 hours');
###########################
<?=$new_times?>
<?=$tomorrow_times?>
当天
明天数据
[e:loop={"select * from [!db.pre!]ecms_zb where livetime >= '{$n_s_time}' and livetime <= '{$n_e_time}'  and classid  in({$class_id})  ORDER BY livetime ASC ",10,24,0}]
[e:loop={"select * from [!db.pre!]ecms_zb where livetime >= '{$t_s_time}' and livetime <= '{$t_e_time}'  and classid in({$class_id}) ORDER BY livetime ASC ",10,24,0}]
<?=date('m-d',strtotime($bqr[livetime]));?>
<?=$bqr[match_class]?>
<?=$bqr[titleurl]?>
<?=$bqr[ranks_img_a]?>
<?=$bqr[ranks_a]?>
if($twoHoursAgo > strtotime($bqr[livetime])){
    $start = '';
    $status = '已结束';
}elseif(strtotime($bqr[livetime]) > time()){
    $start = '';
    $status = '即将开始';
}else{
    $start = 'start';
    $status = '高清直播';
}
$data_type = 1;
if($bqr['classid'] == 15){
    $data_type = 2;
}
$data_important = 0;
if($bqr['isgood'] > 0){
    $data_important = 1;
}
[/e:loop]
###########################  联赛数据
[e:loop={'SELECT * FROM phome_ecms_type WHERE classid = 11 or classid = 12 LIMIT 12',10,24,0}]
<?=$bqr[title]?>
<?=$bqr[titleurl]?>
[/e:loop]


[e:loop={"SELECT * FROM phome_ecms_type WHERE classid = '{$liansai_id}' LIMIT 12",10,24,0}]
<a href="<?=$bqr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>
[/e:loop]
###########################

内容页
标题   [!--pagetitle--]_<?=$public_r[sitename]?>
简介   [!--smalltext--]
关键字：[!--pagekey--]
内容     [!--newstext--]
时间     [!--newstime--]
[e:loop={'15,16',8,0,0}]
[e:loop={'SELECT * FROM phome_enewsclass WHERE bclassid = 4 or bclassid = 5 LIMIT 12',10,24,0}]
[e:loop={'15,16',8,0,0,'','istop desc,newstime desc,id desc'}] 热门排序
标题  <?=$bqr[title]?>
链接  <?=$bqr[titleurl]?>
时间  <?=date('Y-m-d H:i:s',strtotime($bqr[newstime]))?>
序号  <?=$bqno?>
图片  <?=$bqr[titlepic]?>
[/e:loop]


更换了栏目目录地址，为什么信息页地址不更新？
答：因为7.0直接将地址存在数据库里，所以更换目录规则后，需到：后台>系统>数据更新>更新信息页地址：更新数据表中的内容页地址。(注：看左侧菜单，非“数据更新中心”页面里)

面包屑
$cr=$empire->fetch1("select classpath,classname,bname from phome_enewsclass where
classid='".$GLOBALS[navclassid]."' limit 1");
$classpath = $cr['classpath'];
<?=$cr['bname']?>

style="display:none"


//获取列表数据
标题：[!--pagetitle--]_<?=$public_r[sitename]?>
关键字：[!--pagekey--]
描述：[!--pagedes--]           $GLOBALS[navclassid]


列表内容模板(list.var) (*)调取
<ul>
    [!--empirenews.listtemp--]
    <!--list.var1-->
    [!--empirenews.listtemp--]

</ul>

<div id="page">
    <ul class="pagingUl">
        [!--show.listpage--]
    </ul>
</div>

###########################
list .var
$newstime= date('Y年m月d日',$r[newstime]);
$listtemp =  '<li><a href="[!--titleurl--]"><span>・ [!--newstime--]</span>'.$newstime.'  [!--title--]</a></li>';
###########################




###########################


伪静态
列表伪静态
rewrite '^/zqnews.html' /e/action/ListInfo.php?classid=2 last;

rewrite '^/e/tags.html' /e/tags/index.php?tagname=$1;      tagname伪静态

rewrite '^/tags/([a-zA-Z0-9]+).html$' /e/tags/?tagid=$1 last;      tgaid 伪静态



内容页    php 代码里面  $navinfor['keyboard']

###########################
内容页 分类列表地址  面包屑
$cr=$empire->fetch1("select classpath from phome_enewsclass where
classid='".$GLOBALS[navclassid]."' limit 1");
$classpath = $cr['classpath'];

清除更新缓存：设置了伪静态可以在更新数据 里面得   清除临时文件和数据 按钮清除数据
刷新tag页面需要改tag列表页
###########################


<?=$navinfor['keyboard']?>
###########################
[e:loop={2,25,0,0}]

[e:loop={"select * from [!db.pre!]ecms_zb where zd='{$navinfor['zd']}' or kd='{$navinfor['kd']}' ORDER BY livetime ASC ",5,24,0}]    近5场交锋
<?=$bqr[zd]?>
<?=$bqr[kd]?>
链接地址 <?=$bqr[titleurl]?>
时间  <?=date('Y-m-d H:i:s',$bqr[newstime])?>

 <?
      $livetime = strtotime($bqr[livetime]);
      if($livetime > time()){

      }
 ?>

[e:loop={"select ranks_a,ranks_b,ranks_img_a,ranks_img_b,titleurl from [!db.pre!]ecms_zb where match_time >= '{$n_s_time}' or match_time '{$n_e_time}' ",10,24,0}]

[e:loop={"select * from [!db.pre!]ecms_zb where match_time >= '{$b_time}' and match_time <= '{$n_e_time}' and classid = '{$class_id}' ORDER BY match_time ASC ",10,24,0}]
$b_time = date("Y-m-d H:i:s", strtotime("-2 hours"));


[/e:loop]
istop 置顶 0排除置顶 1置顶级别1
isgood  推荐
firsttitle=0 是排除头条 信息
[e:loop={"$zxid",15,0,0,'条件','istop desc,newstime desc,id desc'}]          'selfinfo'
[e:loop={'15,16',8,0,0,'','istop desc,newstime desc,id desc'}] 热门排序





[e:loop={'select ranks_a,ranks_b from phome_ecms_zb where ranks_a=.[!ranks_a]. ',10,24,0}]


//获取友情链接列表
[e:loop={'select lname,lurl,lpic from [!db.pre!]enewslink where checked=1 order by myorder,lid',10,24,0}]
<li>
    <a href="<?=$bqr['lurl']?>" class="qtdw_name" title="<?=$bqr['lname']?>"><?=$bqr['lname']?></a>
</li>
[/e:loop]


帝国cms后台关键字和TAGS自动同步更新的方法：
在添加文章的关键字时，把输入的关键字自动复制到TAGS文本框，功能随简单，但很实用，修改方法如下：
帝国CMS后台–>系统设置–>管理数据表–>新闻系统数据表 (phome_ecms_news)[管理字段] –>special.field[修改系统字段]
把“输入表单替换html代码”中的这一句:
<input name="keyboard" type="text" size="52" value="<?=stripSlashes($r[keyboard])?>">
修改成下面这句:
<input name="keyboard" type="text" size="52" value="<?=stripSlashes($r[keyboard])?>" onkeyup="infotags.value=this.value;">

tag 标签 内容页展示
[e:loop={"SELECT * FROM phome_ecms_news WHERE id = '".$navinfor[id]."' LIMIT 0 , 5",1,24,0}]
<?php
$fr=$empire->fetch1("select infotags from 
            {$dbtbpre}ecms_news_data_{$bqr[stb]} where id='$bqr[id]'");
$keyr=explode(',',$fr[infotags]);
for($i=0;$i<count($keyr);$i++)
{
    echo'<a href="/e/tags/?tagname='.$keyr[$i].'" target=_blank>'.$keyr[$i].'</a>&nbsp;&nbsp;';
}
?>
[/e:loop]

第二步，tag列表页
[e:loop={'select lname,lurl,lpic from [!db.pre!]ecms_news where keyboard LIKE  '%" .$key."%'" order by myorder,lid',10,24,0}]
上述代码e:loop标签中第一个参数为一段sql，查询可显示的一级栏目的id，名称；
第二个参数：0 表示条数不限制；
第三个参数：24 表示e:loop按sql查询；
第四个参数：0 表示显示带标题图和不带标题图的数据


tag列表页
[e:loop={"select newstime,titleurl,title from [!db.pre!]ecms_news where keyboard LIKE  '%" .$key."%'",25,24,0}]

[/e:loop]





******************************************tag伪静态*******************************************************
tga id模式
<ul class="navs"> TAG:
    <?php
    $tbname=$class_r[$navinfor['classid']]['tbname'];
    $ftbname=$dbtbpre."ecms_".$tbname."_data_".$navinfor['stb'];
    $hlt = $empire->fetch1("select infotags from {$ftbname} where id='$navinfor[id]'");
    $a=$hlt[infotags];
    $str=str_replace('，', ',', $a);
    $tag='';
    $t= explode(",", $str);
    for($i=0;$i<count($t);$i++)
    {
        if($t[$i])
        {
            $datar=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$t[$i]' limit 1");
            $tagslink="/tags/".$datar[tagid].".html";
            echo'<a href="'.$tagslink.'" target=_blank>'.$t[$i].'</a>&nbsp;&nbsp;';
        }
    }
    ?>
</ul>
rewrite '^/e/tags.html' /e/tags/index.php?tagname=$1;      tagname伪静态

rewrite '^/tags/([a-zA-Z0-9]+).html$' /e/tags/?tagid=$1 last;      tgaid 伪静态

tganame 模式
[e:loop={"SELECT * FROM phome_ecms_news WHERE id = '".$navinfor[id]."' LIMIT 0 , 5",1,24,0}]
<b>标签：</b>
<?php
$fr=$empire->fetch1("select infotags from 
            {$dbtbpre}ecms_news_data_{$bqr[stb]} where id='$bqr[id]'");
$keyr=explode(',',$fr[infotags]);
for($i=0;$i<count($keyr);$i++)
{
    echo'<a href="/tags.html?tagname='.$keyr[$i].'" target=_blank>'.$keyr[$i].'</a>&nbsp;&nbsp;';
}
?>
[/e:loop]
**************************************tag伪静态***********************************************************

备份数据网站
迁移过来后，要记得删除那个防跨站的文件 ui.user.ini 才能访问其他安装页面

###########################
如果列表页用了 list.var  列表tag不需要动
总结 1. e:loop  sql 语句里面   php变量用 .$key.
    2.e:loop  sql 语句里面 内容页变量用  .[!ranks_a].
###########################



在列表 list. var使用程序
1.给那个框框打勾，选中使用程序
2.$listtemp = '';
3.单引号里面里面注意检查单引号



if(strtotime($r[match_time]) > time() ){

}


if (strtotime($r[match_time]) > time() )
{
   $con = '未开赛';
}else {
   $con = '开赛';
}

$listtemp = '<div class="card-body pt-0 live">
    <div class="list-group list-group-flush list-group-flat pic">
        <div class="list-group-item list-group-item-action d-flex justify-content-between align-items-center live-item status-finished">
            <div class="d-flex align-items-center match-base">
                <span class="match-league ml-3 pt-3">
                    <a title="" href="#" class="text-muted ssmc" style="color:green;"><b>[!--title--]</b></a>
                    <time class="match-time-s">[!--newstime--]</time>
                </span>
            </div>
            <div class="d-flex align-items-center match-info">
                <div class="d-flex align-items-center justify-content-end team-info">
                    <span class="flex-1 line-1" title="[!--ranks_a--] ">[!--ranks_a--]</span>
                    <img loading="lazy" class="lazy" alt="[!--ranks_a--] " src="[!--ranks_img_a--]" onerror="this.src=&#39;/template/13/pc/static/img/defaultImg.png&#39;" alt="西汉姆联 ">
                </div>
                <div class="team-score"><span>VS</span></div>
                <div class="d-flex align-items-center team-info">
                    <img loading="lazy" class="lazy" alt=" [!--ranks_b--]" src="[!--ranks_img_b--]" onerror="this.src=&#39;/template/13/pc/static/img/defaultImg.png&#39;" alt=" 阿斯顿维拉">
                    <span class="flex-1 line-1" title=" [!--ranks_b--]"> [!--ranks_b--]</span>
                </div>
            </div>
            <span class="match-play">
                <a href="https://www.gu38ot.com/live/" title="[!--ranks_a--] VS [!--ranks_b--]">
                    <span class="bs_ztai badge badge-info p-2">高清直播</span>
                </a>
                <a href="[!--titleurl--]" title="[!--ranks_a--] VS [!--ranks_b--]">
                      <span class="bs_ztai badge badge-info p-2">
                         '.$con.'
                      </span>

                </a>
            </span>
        </div>
    </div>
</div>';

<li>上一条：
    [e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}]
    <a href="<?php echo $bqsr[titleurl];$pre='true';?>"><?=$bqr[title]?></a>
    [/e:loop]
    <?php
    if(empty($pre)){
        echo "很抱歉没有了";
    }
    ?>
</li>
<li>下一条：
    [e:loop={'selfinfo',1,0,0,'id>'.$navinfor[id].'','id desc'}]
    <a href="<?php echo $bqsr[titleurl];$next='true';?>"><?=$bqr[title]?></a>
    [/e:loop]
    <?php
    if(empty($next)){
        echo "很抱歉没有了";
    }
    ?>
</li>

tag标签列表
<?php
$hot_sql =$empire->query("select tagid,tagname from {$dbtbpre}enewstags  order by num desc limit 20");
while($r=$empire->fetch($hot_sql ))        //循环获取查询记录
{
    $tagslink="/tags/".$r[tagid].".html";
    echo'<li><a href="'.$tagslink.'" target=_blank>'.$r[tagname].'</a></li>&nbsp;&nbsp;';
}

?>

$zq_info = [6,10,11,12,13,14,15,16,18,20,23,1,25];
$lq_info = [2,7,8,9,19,21,24];
if(in_array($GLOBALS[navclassid], $zq_info )){//足球
if(in_array($GLOBALS[navclassid], $lq_info )){//篮球


rewrite '^/zuqiuzhibo.html' /e/action/ListInfo.php?classid=1 last;
rewrite '^/lanqiuzhibo.html' /e/action/ListInfo.php?classid=2 last;



<p class="footer-desc">友情链接：
    [e:loop={'select lname,lurl,lpic from [!db.pre!]enewslink where checked=1 order by myorder,lid',20,24,0}]
    <a href="<?=$bqr['lurl']?>" title="<?=$bqr['lname']?>" style = 'color:#8A8A8A'><?=$bqr['lname']?></a>
    [/e:loop]
</p>

rewrite '^/zqnews.html' /e/action/ListInfo.php?classid=2 last;
rewrite '^/lqnews.html' /e/action/ListInfo.php?classid=3 last;

<?php
$zq_info = [2,6,8];
$lq_info = [3,7,9];
$lx_name = '热门录像';
$lx_id = '6,7';

$jj_name = '热门集锦';
$jj_id = '8,9';

$xw_name = '热门新闻';
$xw_id = '2,3';
if(in_array($GLOBALS[navclassid], $zq_info )) {//足球
    $lx_name = '足球录像';
    $lx_id = '6';
    $jj_name = '足球集锦';
    $jj_id = '8';
    $xw_name = '足球新闻';
    $xw_id = '2';
}

if(in_array($GLOBALS[navclassid], $lq_info )){//篮球
    $lx_name = '篮球录像';
    $lx_id = '7';
    $jj_name = '篮球集锦';
    $jj_id = '9';
    $xw_name = '篮球新闻';
    $xw_id = '3';
}
?>

<div class="bt-c2"> <p><?=$lx_name?></p></div>
<div class="list">
    <ul>
        [e:loop={"$lx_id",10,0,0,'','istop desc,newstime desc,id desc'}]
        <li class="a2"><a href="<?=$bqr['titleurl']?>"><b><?=date('Y年m月d日 m月d日',$bqr[newstime])?><?=$bqr[title]?></b></a></li>
        [/e:loop]
    </ul>
</div>
<div class="bt-c2"> <p><?=$jj_name?></p></div>
<div class="list">
    <ul>
        [e:loop={"$jj_id",10,0,0,'','istop desc,newstime desc,id desc'}]
        <li class="a2"><a href="<?=$bqr['titleurl']?>"><b><?=date('Y年m月d日 m月d日',$bqr[newstime])?><?=$bqr[title]?></b></a></li>
        [/e:loop]

    </ul>
</div>

<div class="bt-c2"> <p><?=$xw_name?></p></div>
<div class="list">
    <ul>
        [e:loop={"$xw_id",10,0,0,'','istop desc,newstime desc,id desc'}]
        <li class="a2"><a href="<?=$bqr['titleurl']?>"><b><?=date('Y年m月d日 m月d日',$bqr[newstime])?><?=$bqr[title]?></b></a></li>
        [/e:loop]

    </ul>
</div>

rewrite '^/zqluxiang.html' /e/action/ListInfo.php?classid=1 last;
rewrite '^/lqluxiang.html' /e/action/ListInfo.php?classid=3 last;

增加数据数据库
phome_ecms_news            filename 文件id注意不同得
phome_ecms_news_data_1
phome_ecms_news_index


佛山寒麒宏
重庆盛桉乐商贸有限公司
rewrite '^/service.html' /e/action/ListInfo.php?classid=1 last;
rewrite '^/news.html' /e/action/ListInfo.php?classid=2 last;
rewrite '^/about.html' /e/action/ListInfo.php?classid=3 last;





<?php
$week_array = ['日', '一', '二', '三', '四', '五', '六'];

$time_=time();
for($i=0;$i<2;$i++){
if($i == 0){
    $time=$time_;
    $newstime_select = date('Y-m-d H:i:s', $time-8400);    // 2小时20分钟=8400秒
    $newstime_end = date('Y-m-d 23:59:59', $time);
    $week = date('w');
}else{
    $time=strtotime(date('Y-m-d 00:00:00', $time_+$i*24*3600));
    $newstime_select = date('Y-m-d H:i:s', $time);
    $newstime_end = date('Y-m-d 23:59:59', $time);
    $week = date('w', $time);
}

$sql="select * from {$dbtbpre}ecms_zb where livetime>'$newstime_select' and livetime<'$newstime_end' order by istop DESC,livetime ASC  limit 30";
$key_sql=$empire->query($sql);
if(empty($empire->fetch($key_sql))){
    $sql="select * from {$dbtbpre}ecms_zb  order by istop DESC,livetime ASC  limit 30";
    $key_sql=$empire->query($sql);
}
$j=0;
$data = array();
while($r=$empire->fetch($key_sql)){
    $data[$j] = $r;
    $j++;
}


?>


    <h2><?=date('Y-m-d', $time)?> 周<?=$week_array[$week]?></h2>

    <?php
    $k = 0;
    foreach($data as $data_v){
        $k++;

        $livetime = strtotime($data_v[livetime]);
        if($time<$livetime){
            $liver = '即将开始';
            $sq    = '#0778b8';
            $tq    = '';
        }elseif($time>$livetime && $time<$livetime+8400){
            $liver = '高清直播';
            $sq    = 'red';
            $tq   = 'start';
        }else{
            $liver = '已结束';
            $sq    = 'none';
            $tq    = 'end';
        }

        $lslj='';
        if($data_v[classid]==1){
            $ls='/zuqiu';
        }else{
            $ls='/lanqiu';
        }
        if($data_v[lspy]){
            $lslj = $ls.'/'.$data_v[lspy]; // 联赛链接
        }
?>

        循环的内容列表

        <?php
    }
    }
    ?>

<img class="lazy" src="/img/zuqiu.png" data-original="https://www.tiankecheng.com/img/919654820278af6a4ae8d0821460722d.png" alt="斯莱曼" title="斯莱曼">

<script src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.lazyload.min.js"></script>
<script>
    $(function () {
        $(".lazy").lazyload({effect: "fadeIn", threshold: 400, failurelimit: 10});
    });
</script>
class="lazy" src="/images/zd.png" data-original
class="lazy" src="/images/kd.png" data-original

class="lazy" src="/images/home_def.png" data-original
class="lazy" src="/images/away_def.png" data-original
[!--temp.lazy--]
livetime >= '{$n_s_time}' and livetime <= '{$n_e_time}'  and
livetime >= '{$t_s_time}' and livetime <= '{$t_e_time}'  and
zbvideo.png  即将开始
<?=$clurl?>
images/zuqiu.png

 采集密码：zhibo-ecmsadmin
lspy= '" . $lsp. "' and


<IFRAME frameBorder="0" width="0" height="0" marginWidth="0" marginHeight="0" id="dorepage" name="dorepage" scrolling="no" src="/e/extend/DoTimeRepage/"></IFRAME>

